package com.kernel.kotlintest

import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlCData
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement

/**
 * 请求系统头
 */
@JacksonXmlRootElement(localName = "root")
class TestBean {
    @JacksonXmlProperty(localName = "fileFlag")
    var fileFlag: String? = null

    @JacksonXmlProperty(localName = "BODY")
    var body: Body? = Body()

    class Body {
        @JacksonXmlProperty(localName = "mobile")
        var mobile: String? = null

        @JacksonXmlProperty(localName = "type", isAttribute = true)
        var type: String? = null

        @JacksonXmlElementWrapper(localName = "list")
        @JacksonXmlProperty(localName = "item")
        var itemList: MutableList<Item> = mutableListOf()
    }

    class Item {
        @JacksonXmlProperty(localName = "name")
        var name: String? = null

        @JacksonXmlProperty(localName = "value")
        var value: String? = null

        @JacksonXmlCData
        @JacksonXmlProperty(localName = "text")
        var text: String? = null
    }
}
